﻿using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using Top.Web;
using Top.Web.Api;
using Top.Web.Api.Filters;
using Top.Core;
using Top.PointStore.Business;
using Top.PointStore.Web.Filters;
//using Top.PointStore.Filters;


namespace Top.PointStore.Controllers
{
    /// <summary>
    /// 积分明细
    /// </summary>
    [Provider]
    public class PointDetailController : ApiBase
    {
        //
        // GET: /PointDetail/

        /// <summary> 根据获取积分明细列表
        /// </summary>
        /// <returns></returns>
        [Login]
        public object GetList(int pointKid, int pageIndex = 1, int pageSize = 12)
        {
            return PointDetailManager.GetList(Pager.Create(pageIndex, pageSize), pointKid);
        }

        /// <summary>根据用户编号获取数据列表
        /// </summary>
        [Login]
        public async Task<object> GetListByUserKid(int pageIndex = 1, int pageSize = 12)
        {
            return await PointDetailManager.GetPageListByUserKid(Pager.Create(pageIndex, pageSize), User);
        }
        [NoLogin]
        public object GetListByPhone(string phone,int pageIndex = 1, int pageSize = 12)
        {
            return PointDetailManager.GetPageListByPhone(Pager.Create(pageIndex, pageSize), phone);
        }

        public object GetUserPointDetail(int pointId,int pageIndex = 1, int pageSize = 12)
        {
            return PointDetailManager.GetPageListByPointId(Pager.Create(pageIndex, pageSize), pointId);
        }
    }
}
